package com.learn.quartz.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.learn.quartz.entity.TaskConfigEntity;
import org.quartz.SchedulerConfigException;
import org.quartz.SchedulerException;

/**
 * @description: java类作用描述
 * @author: MI
 * @email: 448341911@qq.com
 * @createDate: 2023/10/28 20:08
 * @updateUser: MI
 * @updateDate: 2023/10/28 20:08
 * @updateRemark: 修改内容
 * @version: v1.0
 */
public interface ScheduleJobService extends IService<TaskConfigEntity> {
    /**
     * 程序启动开始加载定时任务
     */
    void startJob();

    /**
     * 停止任务
     *
     * @param taskId
     * @throws SchedulerException
     */
    void stopJob(String taskId) throws SchedulerException;

    /**
     * 恢复任务
     *
     * @param taskId
     * @throws SchedulerException
     */
    void resumeJob(String taskId) throws SchedulerException;

    /**
     * 添加新的Job
     *
     * @param taskId
     * @throws SchedulerConfigException
     */
    void loadJob(String taskId) throws SchedulerConfigException;

    /**
     * 卸载任务
     * @param taskId
     * @throws SchedulerException
     */
    void unloadJob(String taskId) throws SchedulerException;

    /**
     * 重新加载执行计划
     *
     * @param taskId
     * @throws Exception
     */
    void reload(String taskId) throws Exception;
}
